$('.nativedatepicker').live("click", function(event) {
		var currentField = $(this);
		var myNewDate = Date.parse(currentField.val()) || new Date();
		if(typeof myNewDate === "number"){
				myNewDate = new Date (myNewDate);
		}
		// Same handling for iPhone and Android
		window.plugins.datePicker.show({
			date : myNewDate,
			mode : 'date', // date or time or blank for both
			allowOldDates : true
		}, function(returnDate) {
			alert(returnDate);
			var newDate = new Date(returnDate);
			currentField.val(newDate.toDateString());
			
			// This fixes the problem you mention at the bottom of this script with it not working a second/third time around, because it is in focus.
			currentField.blur();
		});
});

$('.nativetimepicker').live("click" , function(event) {
		var currentField = $(this);
		var time = currentField.val();
		var myNewTime = new Date();
		if(typeof myNewDate === "number"){
			myNewDate = new Date (myNewDate);
		}
		//myNewTime.setHours(time.substr(0, 2));
		//myNewTime.setMinutes(time.substr(3, 2));

		// Same handling for iPhone and Android
		window.plugins.datePicker.show({
			date : myNewTime,
			mode : 'time', // date or time or blank for both
			allowOldDates : true
		}, function(returnDate) {
		  // returnDate is generated by .toLocaleString() in Java so it will be relative to the current time zone
			//var newDate = new Date(returnDate);
			currentField.val(returnDate.toString());
			currentField.blur();
		});
});